Added a types attribute to annotate() and candidates()#9
Added a types attribute to annotate() and candidates()#9aolieman wants to merge 37 commits intoubergrape:masterfrom
Conversation
|
The problem of using a types filter with the statistical backend was an issue with missing documentation. Besides setting the types parameter, But I would still like this to work asap ;-). My suggestion is to include all filter-related parameters in a filters attribute, which accepts a dictionary with any optional filters. I'm not sure if it's necessary, but I've included Usage example: only_person_filter = {
'policy': "whitelist",
'types': "DBpedia:Person",
'coreferenceResolution': False
}
spotlight.annotate("http://localhost:2223/rest/annotate",
"Komen Albert Verlinde en Metallica elkaar wel eens tegen in de showbizz?",
filters=only_person_filter)
# [{u'similarityScore': 0.9999999700393123, u'surfaceForm': u'Albert Verlinde', u'support': 76, u'offset': 6, u'URI': u'http://nl.dbpedia.org/resource/Albert_Verlinde', u'percentageOfSecondRank': 0.0, u'types': u'DBpedia:Agent,Schema:Person,DBpedia:Http://xmlns.com/foaf/0.1/Person,DBpedia:Person,DBpedia:Presenter'}] |
|
That sounds great :D Are you still using it this way ? =) |
|
Yes, I am. By using a single |
|
Hi @originell, Thanks! |
… server-side filtering of resources. It also makes for a nice addition to the policy parameter.
- Specified tested python versions - Declared dependency versions as PEP 440 compatible release clauses - New package keywords - Added myself as author
…lper function; several cosmetic and documentation improvements
Tagging version old-issue-links old-issue-links
Tagging version add-metadata-author-maintainer add-metadata-author-maintainer
Tagging version compat-open-encoding compat-open-encoding
Tagging version pip-version pip-version
Merge branch 'ShomyLiu-master' into develop
Added a types attribute to annotate() and candidates(), which enables server-side filtering of resources. It also makes for a nice addition to the policy parameter.
I've tested it on both kinds of backends, but it only works properly with the Lucene-backed web service. This is, however, not a bug in pyspotlight and seems to be an unnoticed bug in Spotlight's statistical backend. It will be discussed in DBpS issue #251.